/**
 * 交易模块接口列表
 */

import base from './base'; // 导入接口域名列表
import axios from 'axios';
import qs from 'qs';
import login from "./user"; // 根据需求是否导入qs模块

//获取用户列表
export const getclient = ()=>{
  return axios.post(`${base.base}/trade/get_list_client`)
};

//获取可以交易合约列表
export const getcontract = (params)=>{
  return axios.post(`${base.base}/trade/get_list_contract`,
    qs.stringify(params)
  )
};

//获取所有交易合约列表
export const getcontract_all = (params)=>{
  return axios.post(`${base.base}/trade/get_list_contract_all`,
    qs.stringify(params)
  )
};

//获取所有交易合约列表
export const getcontract_update = (params)=>{
  return axios.post(`${base.base}/trade/get_list_contract_update`,
    qs.stringify(params)
  )
};

//获取用户基本信息、风险控制
export const getclientinfo = (params)=>{
  return axios.post(`${base.base}/trade/get_client_info`,
    qs.stringify(params)
  )
};
//获取合约基础参数、批量参数
export const getParameter = (params)=>{
  return axios.post(`${base.base}/trade/get_parameter`,
    qs.stringify(params)
  )
};

//添加合约基础参数、批量参数
export const inseertParameter = (params)=>{
  return axios.post(`${base.base}/trade/insert_parameter`,
    qs.stringify(params)
  )
};
//删除合约基础参数、批量参数
export const deleteParameter = (params)=>{
  return axios.post(`${base.base}/trade/delete_parameter`,
    qs.stringify(params)
  )
};
//修改合约基础参数、批量参数
export const updateParameter = (params)=>{
  return axios.post(`${base.base}/trade/update_parameter`,
    qs.stringify(params)
  )
};
//修改风险信息
export const updateRisk = (params)=>{
  return axios.post(`${base.base}/trade/update_risk`,
    qs.stringify(params)
  )
};
//获取添加策略强平点
export const getLatestLiquidation = (params)=>{
  return axios.post(`${base.base}/trade/get_latest_liquidation`,
    qs.stringify(params)
  )
};
//添加启动策略
export const insertStrategy = (params)=>{
  return axios.post(`${base.base}/trade/insert_strategy`,
    qs.stringify(params)
  )
};
//启动所选未启动策略
export const startStrategy = (params)=>{
  return axios.post(`${base.base}/trade/start_strategy`,
    qs.stringify(params)
  )
};
//删除所选未启动策略
export const deleteStrategy = (params)=>{
  return axios.post(`${base.base}/trade/delete_strategy`,
    qs.stringify(params)
  )
};
//获取最新价格、获取指数价格
export const getPrice = ()=>{
  return axios.post(`${base.base}/trade/get_list_price_pro`,
  )
};
//一键平移
export const translationAll = (params)=>{
  return axios.post(`${base.base}/trade/translation`,
    qs.stringify(params)
  )
};
//策略停止
export const stopAll = (params)=>{
  return axios.post(`${base.base}/trade/stop`,
    qs.stringify(params)
  )
};
//平仓
export const endAll = (params)=>{
  return axios.post(`${base.base}/trade/end`,
    qs.stringify(params)
  )
};
//同步委托
export const synchronous = (params)=>{
  return axios.post(`${base.base}/trade/synchronous`,
    qs.stringify(params)
  )
};
//修改策略参数
export const updateStrategy = (params)=>{
  return axios.post(`${base.base}/trade/update_strategy`,
    qs.stringify(params)
  )
};
//获取某用户，某合约的时间-价格触发策略
export const getListTimePrice = (params)=>{
  return axios.post(`${base.base}/trade/get_list_time_price`,
    qs.stringify(params)
  )
};
//获取某用户，某合约的点位平移策略
export const getListPointTranslation = (params)=>{
  return axios.post(`${base.base}/trade/get_list_point_translation`,
    qs.stringify(params)
  )
};
//新增某用户，某合约的时间-价格触发策略(价格如何获取未处理)
export const insertTimePrice = (params)=>{
  return axios.post(`${base.base}/trade/insert_time_price`,
    qs.stringify(params)
  )
};

//新增某用户，某合约的点位平移策略
export const insertPointTranslation = (params)=>{
  return axios.post(`${base.base}/trade/insert_point_translation`,
    qs.stringify(params)
  )
};
//修改某用户，某合约的时间-价格触发策略(价格如何获取未处理)
export const updateTimePrice = (params)=>{
  return axios.post(`${base.base}/trade/update_time_price`,
    qs.stringify(params)
  )
};
//修改某用户，某合约的点位平移策略
export const updatePointTranslation = (params)=>{
  return axios.post(`${base.base}/trade/update_point_translation`,
    qs.stringify(params)
  )
};
//删除某用户，某合约的时间-价格触发策略
export const deleteTimePrice = (params)=>{
  return axios.post(`${base.base}/trade/delete_time_price`,
    qs.stringify(params)
  )
};
//删除某用户，某合约的点位平移策略
export const deletePointTranslation = (params)=>{
  return axios.post(`${base.base}/trade/delete_point_translation`,
    qs.stringify(params)
  )
};
//选中编辑
export const updateStrategyBatch = (params)=>{
  return axios.post(`${base.base}/trade/update_strategy_batch`,
    qs.stringify(params)
  )
};

//委托分布图
export const distributionEntrust = (params)=>{
  return axios.post(`${base.base}/trade/distribution_entrust`,
    qs.stringify(params)
  )
};

//委托分布图——2
export const distributionEntrust2 = (params)=>{
  return axios.post(`${base.base}/trade/distribution_entrust_2`,
    qs.stringify(params)
  )
};

//委托分布图——3
export const distributionEntrust3 = (params)=>{
  return axios.post(`${base.base}/trade/distribution_entrust_3`,
    qs.stringify(params)
  )
};

//添加某用户，某合约的自动离场
export const insertAutoleave = (params)=>{
  return axios.post(`${base.base}/trade/insert_autoleave`,
    qs.stringify(params)
  )
};
//获取某用户，某合约的自动离场
export const getListAutoleave = (params)=>{
  return axios.post(`${base.base}/trade/get_list_autoleave`,
    qs.stringify(params)
  )
};

//删除某用户，某合约的自动离场
export const deleteAutoleave = (params)=>{
  return axios.post(`${base.base}/trade/delete_autoleave`,
    qs.stringify(params)
  )
};

//编辑某用户，某合约的自动离场
export const updateAutoleave = (params)=>{
  return axios.post(`${base.base}/trade/update_autoleave`,
    qs.stringify(params)
  )
};

//添加某用户，某合约的自动启动策略
export const insertAutorun = (params)=>{
  return axios.post(`${base.base}/trade/insert_autorun`,
    qs.stringify(params)
  )
};

//获取某用户，某合约的自动启动策略
export const getListAutorun = (params)=>{
  return axios.post(`${base.base}/trade/get_list_autorun`,
    qs.stringify(params)
  )
};

//删除某用户，某合约的自动启动策略
export const deleteAutorun = (params)=>{
  return axios.post(`${base.base}/trade/delete_autorun`,
    qs.stringify(params)
  )
};
//编辑某用户，某合约的自动启动策略
export const updateAutorun = (params)=>{
  return axios.post(`${base.base}/trade/update_autorun`,
    qs.stringify(params)
  )
};
//添加某用户，某合约的冲刺
export const insertSprint = (params)=>{
  return axios.post(`${base.base}/trade/insert_sprint`,
    qs.stringify(params)
  )
};
//获取某用户，某合约的冲刺
export const getListSprint = (params)=>{
  return axios.post(`${base.base}/trade/get_list_sprint`,
    qs.stringify(params)
  )
};

//删除某用户，某合约的冲刺
export const deleteSprint = (params)=>{
  return axios.post(`${base.base}/trade/delete_sprint`,
    qs.stringify(params)
  )
};
//编辑某用户，某合约的冲刺
export const updateSprint = (params)=>{
  return axios.post(`${base.base}/trade/update_sprint`,
    qs.stringify(params)
  )
};

//开始回测
export const startBack = (params)=>{
  return axios.post(`${base.base}/startBackTest`,
    qs.stringify(params)
  )
};
//删除策略
export const deleteBack = (params)=>{
  return axios.post(`${base.base}/deleteStrategy`,
    qs.stringify(params)
  )
};
//重置
export const resetData = (params)=>{
  return axios.post(`${base.base}/resetData`,
    qs.stringify(params)
  )
};
//暂停策略
export const stopBack = (params)=>{
  return axios.post(`${base.base}/suspendBackTest`,
    qs.stringify(params)
  )
};
//终止策略
export const stopBackTest = (params)=>{
  return axios.post(`${base.base}/stopBackTest`,
    qs.stringify(params)
  )
};
//盈亏计算切换是否包含未启动
export const updateProfitLossCal = (params)=>{
  return axios.post(`${base.base}/trade/update_profit_loss_cal`,
    qs.stringify(params)
  )
};

//获取日志
export const getLogs = (params)=>{
  return axios.post(`${base.base}/getLogs`,
    qs.stringify(params)
  )
};

//获取日志数据
export const getTestData = (params)=>{
  return axios.post(`${base.base}/getTestData`,
    qs.stringify(params)
  )
};

//时间设置
export const setTime = (params)=>{
  return axios.post(`${base.base}/setTime`,
    qs.stringify(params)
  )
};
//获取默认时间
export const getDefultTime = (params)=>{
  return axios.post(`${base.base}/getDefultTime`,
    qs.stringify(params)
  )
};

//获取k线
export const getKlineData = (params)=>{
  return axios.post(`${base.base}/getKlineData`,
    qs.stringify(params)
  )
};

export default getclient;
